# Traverse a Square - Part 4 - Using Odometry and Orientation Data

two things to track - orientation and distance turned by each wheel for side transit


In [ ]:
%run 'Set-up.ipynb'
%run 'Loading scenes.ipynb'
%run 'vrep_models/PioneerP3DX.ipynb'

In [ ]:
%%vrepsim '../scenes/OU_Pioneer.ttt' PioneerP3DX

# Use the time library to set a wait duration
import time

#Tell the robot to move forward by setting both motors to speed 1
robot.move_forward(1)
print(robot.getvalleft(), robot.getvalright())
#Wait for two seconds
time.sleep(2)
print(robot.getvalleft(), robot.getvalright())
robot.rotate_left()
time.sleep(2)
print(robot.getvalleft(), robot.getvalright())
#At the end of the programme the simulation stops
#The robot returns to its original location

In [ ]:
%%vrepsim '../scenes/OU_Pioneer.ttt' PioneerP3DX


get_orientation_degrees

In [ ]:
#need to add the odometry/rotation count child script to the robot model